<?php
/**
 * 
 * User/IndexAction.class.php (前台会员中心模块)
 *
 * @package      	jgsat
 * @author          liuxun QQ:147613338 <admin@jgsat.cn>
 * @copyright     	Copyright (c) 2008-2011  (http://www.jgsat.com)
 * @license         http://www.jgsat.com/license.txt
 * @version        	jgsat企业网站管理系统 v2.1 2012-10-08 jgsat.cn $
 */
if(!defined("JGsat")) exit("Access Denied");
class User_guestbookAction extends BaseAction
{

	function _initialize()
    {	
		parent::_initialize();

      //  echo ($this->_userid);exit;
		if(!$this->_userid){

			$this->assign('jumpUrl',U('Mobile/Login/index'));
			$this->error(L('nologin'));
			exit;
		}


		$this->dao = M('User');
		$this->assign('bcid',0);
		$user = $this->dao->find($this->_userid);
        $this->user=$user;
		$this->assign('vo',$user);
        $this->assign('title','餐饮空间_个人中心');
		unset($_POST['status']);
		unset($_POST['groupid']);
		unset($_POST['amount']);
		unset($_POST['point']);
		$_GET =get_safe_replace($_GET);
        
    }

    public function index()
    {
        $user= $this->user;
         $this->display();


    }

	public function fblog(){


		$catid='5';
		$this->Urlrule =F('Urlrule');


		$p= max(intval($_REQUEST[C('VAR_PAGE')]),1);
		if($catid){
			$cat = $this->categorys[$catid];
			$bcid = explode(",",$cat['arrparentid']);
			$jgbcid = $bcid;
			$bcid = $bcid[1];
			if($bcid == '') $bcid=intval($catid);
			if(empty($module))$module=$cat['module'];
			$this->assign('module_name',$module);
			unset($cat['id']);
			$this->assign($cat);
			$cat['id']=$catid;
			$this->assign('jgbcid',$jgbcid);
			$this->assign('catid',$catid);
			$this->assign('bcid',$bcid);
		}
		if($cat['readgroup'] && $this->_groupid!=1 && !in_array($this->_groupid,explode(',',$cat['readgroup']))){$this->assign('jumpUrl',URL('User-Login/index'));$this->error (L('NO_READ'));}
		$fields = F($this->mod[$module].'_Field');
		foreach($fields as $key=>$r){
			$fields[$key]['setup'] =string2array($fields[$key]['setup']);
		}
		$this->assign ( 'fields', $fields);


		$seo_title = $cat['title'] ? $cat['title'] : $cat['catname'];
		$this->assign ('seo_title',$seo_title);
		$this->assign ('seo_keywords',$cat['keywords']);
		$this->assign ('seo_description',$cat['description']);
		$this->assign('title','餐饮空间_发布记录');


		if($catid){
			$seo_title = $cat['title'] ? $cat['title'] : $cat['catname'];
			$this->assign ('seo_title',$seo_title);
			$this->assign ('seo_keywords',$cat['keywords']);
			$this->assign ('seo_description',$cat['description']);


			$where = 'userid='.$this->_userid;
			$typeid=$_GET['typeid'];
			if($typeid){
				$where .= ' and typeid='.$typeid;
				$this->assign('title','餐饮空间_我的预约');
			}
			// echo $where;exit;
			if(empty($cat['listtype'])){
				$this->dao= M($module);
				$count = $this->dao->where($where)->count();
				//echo $this->dao->getLastSql();exit;

				if($count){
					import ( "@.ORG.Page" );
					$listRows =  !empty($cat['pagesize']) ? $cat['pagesize'] : C('PAGE_LISTROWS');

					$page = new Page ( $count, $listRows );
					// print_r($page->urlrule );exit;
					$pages = $page->preshow();
					$field = '*';
					$order='listorder ,createtime desc,id desc';
					if($_GET['order']){
						$order=$_GET['order'].' desc';
					}

					$list = $this->dao->field($field)->where($where)->order($order)->limit($page->firstRow . ',' . $page->listRows)->select();
					//echo $this->dao->getLastSql();exit;
					$this->assign('pages',$pages);
					$this->assign('list',$list);
					$this->assign('typeid',$typeid);
				}
				$template_r = 'list';
			}else{
				$template_r = 'index';
			}
		}else{
			$template_r = 'list';
		}
		$template = $cat['template_list'] ? $cat['template_list'] : $template_r;

//print_r($list);exit;



		$this->display();

	}










}
?>